function AddVehicleFillUpDateView(addVehicleFillUpView) {
	var self = Ti.UI.createView({
		contentWidth:'auto',
		contentHeight:'auto',
		top:0,
		backgroundColor:'black'
	});
	
	picker = Ti.UI.createPicker({
		type:Ti.UI.PICKER_TYPE_DATE_AND_TIME
	});
	
	resetAll(picker);
	self.add(picker);

	picker.addEventListener('change', function(e) {
		currentPickedDate = e.value;
	});
	
	self.addEventListener('requestedPickedValueEvent',function(e) {	
		addVehicleFillUpView.fireEvent('setFillUpDateEvent', {
			pickedDateTime:String.formatDate(currentPickedDate) 
				+ ' ' + String.formatTime(currentPickedDate)
		});
		
		resetAll(picker);
	});
	
	self.addEventListener('resetEvent', function(e) {
		resetAll(picker);
	});
	
	return self;
}

var currentPickedDate = new Date();

function resetAll(picker) {
	var todaysDate = new Date();
	var lastYear = new Date();
	lastYear.setYear(todaysDate.getYear() - 1);
	picker.setMinDate(lastYear);
	picker.setMaxDate(todaysDate);
	picker.setValue(todaysDate);
}

module.exports = AddVehicleFillUpDateView;